package org.red_cross_service.controller;

import org.red_cross_service.common.anno.NoNeedToken;
import org.red_cross_service.common.response.Response;
import org.red_cross_service.domain.entity.CarouselEntity;
import org.red_cross_service.service.CarouselService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/api/carousel")
@CrossOrigin
public class CarouselController {
    @Autowired
    private CarouselService carouselService;
    //轮播图增删改查接口

    @NoNeedToken
    @RequestMapping("/list")
    public Response getCarouselList(@RequestBody CarouselEntity carouselEntity){
        return carouselService.getCarouselList(carouselEntity);
    }
    @NoNeedToken
    @RequestMapping("/add")
    public Response addCarousel(@RequestBody CarouselEntity carouselEntity){
        return carouselService.addCarousel(carouselEntity);
    }
    @NoNeedToken
    @RequestMapping("/update")
    public Response updateCarousel(@RequestBody CarouselEntity carouselEntity){
        return carouselService.updateCarousel(carouselEntity);
    }
    @NoNeedToken
    @RequestMapping("/delete")
    public Response deleteCarousel(@RequestBody CarouselEntity carouselEntity){
        return carouselService.deleteCarousel(carouselEntity.getCarouselId());
    }

    @NoNeedToken
    //获取单条记录
    @RequestMapping("/selectOne")
    public Response selectOne(@RequestBody CarouselEntity carouselEntity){
        return carouselService.selectOne(carouselEntity);
    }

}

